Delphi 生成二维码【PaintBox】并保存为本地文件添加至【Image】控件中 您所在的位置:网站首页 cerulean box二维码生成怎么用 Delphi 生成二维码【PaintBox】并保存为本地文件添加至【Image】控件中

Delphi 生成二维码【PaintBox】并保存为本地文件添加至【Image】控件中

2024-07-16 07:28| 来源: 网络整理| 查看: 265

RAD Studio 10.3 测试√

需要控件:scEdit、scGPButton、Image、PaintBox 在这里插入图片描述 需要声明:DelphiZXIngQRCode 下载地址:「DelphiZXIngQRCode.pas」https://www.aliyundrive.com/s/VXokj7kUD5i 【同时记得把路径也添加了,能搜索到就行,不管用那种方法】

private QRCodeBitmap: TBitmap; public procedure Update;

窗体的 OnCreate事件 和 OnDestroy事件:

procedure TForm1.FormCreate(Sender: TObject); // 窗体创建 begin QRCodeBitmap := TBitmap.Create; // 代码图位 Update; end; procedure TForm1.FormDestroy(Sender: TObject); // 窗体销毁 begin QRCodeBitmap.Free; end;

PaintBox的 OnPaint事件:

procedure TForm1.PaintBox1Paint(Sender: TObject); var Scale: Double; begin PaintBox1.Canvas.Brush.Color := clRed; // 背景颜色 PaintBox1.Canvas.FillRect(Rect(0, 0, PaintBox1.Height, PaintBox1.Width)); // 填充矩形 if ((PaintBox1.Width > 0) and (PaintBox1.Height > 0)) then begin if PaintBox1.Width


【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有